﻿using System;
using System.Collections.Generic;

namespace DX_Recognize.Entitys
{
    //数据库标准参数类
    public class StandardEGP
    {
        public int Dimension { get; set; }
        public int TH { get; set; }
        public int TD { get; set; }
        public int BushSize { get; set; }
        public int BushTH { get; set; }
        public int BushTD { get; set; }
    }

    //在标准表中 导柱拉杆的字段一致
    public class StandardGPSP
    {
        //直径
        public int Dimension { get; set; }
        //托位高度
        public int TH { get; set; }
        //导柱/拉杆托位
        public int TD { get; set; }
        //导套外径
        public int BushSize { get; set; }
        //导套托位高度
        public int BushTH { get; set; }
        //导套托位
        public int BushTD { get; set; }
        public int BK_1 { get; set; }
        //拉杆避空孔
        public int BK_2 { get; set; }
    }

    //回针
    public  class StandardRP
    {
        public int Dimension { get; set; }
        public int TH { get; set; }
        //外圈直径
        public int TD { get; set; }
    }

    public class StandardScrew {
        public int Dimension { get; set; }
        public decimal BaseDimension { get; set; }
        public decimal ThroughDimension { get; set; }
        public decimal TH { get; set; }
        //平面图，最外圈直径（公差+2,-0）
        public decimal TD { get; set; }
        public decimal BlindDepth { get; set; }
        public decimal ScrewDepth { get; set; }
    }

    //花式和板件的对应关系
    public class StandardCategoryBoard
    {
        public string boardCode { get; set; }
        public string category { get; set; }
        public string boardName { get; set; }
        public string shortName { get; set; }
        public int sortNum { get; set; }
        //用于连接板厚参数
        public string boardThick { get; set; }
    }

    public class StandardMoldType
    {
        public string shortName { get; set; }
        public string category { get; set; }
    }

    public class StandardSteel
    {
        public string ItemNumber { get; set; }
        public string ItemDesc { get; set; }
    }

    //标准板厚信息
    public class StandardBoardThick
    {
        public string boardCode { get; set; }

        public string boardName { get; set; }

        public int moldSize { get; set; }

        public string sysShortName { get; set; }

        public string boardThick { get; set; }
    }

    public class StandBoardWidth
    {
        public int xinhao { get; set; }
        public int W { get; set; }
        public string name { get; set; }
        public string series { get; set; }
    }

    //标准孔数据
    [Serializable]
    public class StandardHoleData
    {
        public int MouldSize { get; set; }
        public string MouldSeries { get; set; }
        public string Item{ get; set; }
        public int ItemDim { get; set; }
        public int ItemNum{ get; set; }
        public int ItemL { get; set; }
        public int ItemW { get; set; }
        //平面图分中X坐标
        public double ItemX { get; set; }
        //平面图分中Y坐标
        public double ItemY { get; set; }
        //方铁区间相对位置
        public FPosType fPosType { get; set; } = FPosType.NONE;
        //一般来讲 都存在一个偏孔 (判断是否是偏孔)
        public Boolean partialF { get; set; } = false;
    }

    //零件和板关系 标准数据
    public class StandardBoardRelItem
    {
        public string category { get; set; }
        public string BoardCode { get; set; }
        public string BoardName { get; set; }
        public string ItemCode { get; set; }
        public string ItemName { get; set; }
        public string HoleName { get; set; }
    }

    //花式包含的零件 标准数据
    public class StandardSeriesRelItem
    {
        public string MouldSeries { get; set; }
        public double ItemL { get; set; }
        public int ItemDim { get; set; }
        public string ItemCode { get; set; }
        public string ItemName { get; set; }
        public int ItemNum { get; set; }
        public string ItemRemark { get; set; }
    }

    //拉杆介子&螺丝 标准数据
    public class StandardSPScrewMeson
    {
        public int spDim { get; set; }
        public int spTD { get; set; }
        public int spTH { get; set; }
        public int MesonScrewDim { get; set; }
        public int MesonScrewL { get; set; }
        public double spMesonDim { get; set; }
        public int spMesonTD { get; set; }
        public int spMesonTH { get; set; }
    }

    public class MergeCompareItemComparer : IEqualityComparer<LabourSingleItem>
    {
        public bool Equals(LabourSingleItem x, LabourSingleItem y)
        {
            return x.ItemName.Equals(y.ItemName) && x.ItemNum == y.ItemNum;
        }
        public int GetHashCode(LabourSingleItem obj)
        {
            unchecked 
            {
                int hash = 17;
                hash = hash * 23 + obj.ItemName.GetHashCode();
                hash = hash * 23 + obj.ItemNum.GetHashCode();
                return hash;
            }
        }
    }


    //数据库 标准拉令
    public class StandardPulling
    {
        public int sortNum { get; set; }
        public int minW { get; set; }
        public int maxW { get; set; }
        public int minL { get; set; }
        public int maxL { get; set; }

        public int AB { get; set; }
        public int skmb { get; set; }

        public int tuoban { get; set; }
        //底板
        public int dbmb { get; set; }
        //水口推板 推板、流道板
        public int tuiban { get; set; }
        public int fangtie { get; set; }
        public int zhenban { get; set; }
    }

    //标准螺丝 方铁螺丝，针板螺丝，底板螺丝，面板螺丝
    public class StandardScrewDim
    {
        //直径
        public double Dim { get; set; }
        //内圈直径
        public double InDim { get; set; }
        //外圈直径
        public double OutDim { get; set; }
        public StandardScrewDim(double dim, double inDim, double outDim)
        {
            Dim = dim;
            InDim = inDim;
            OutDim = outDim;
        }
    }

    //Hole_mould 数据库落数 板加工面
    [Serializable]
    public class HoleMould
    {
        public int Cut { get; set; }
       /* public string order_number {get; set; }
        public string systemId { get; set; }*/
        public decimal L { get; set; }
        public decimal W  {get; set; }
        public decimal H  {get; set; }
        public decimal plate_X0 { get; set; }
        public decimal plate_Y0 { get; set; }
        public decimal plate_Z0 { get; set; }
        public int plate_LineNo { get; set; }
        public string Bat { get; set; }
        public string Plate_Sur { get; set; }
        public string Plate_Base { get; set; }
      
        public string plate_name { get; set; }
       
        public string plate_Attribute { get; set; }
        public int version { get; set; }
        //冗余数据 不落库
        public string BoardUID { get; set; }
        public string BoardCode { get; set; }
        //X中心坐标 主要是用于记录LRC方铁的X坐标
        public double CenterX { get; set; }
        //冗余 用于绑定和方铁的位置关系
         public FPosType fPosType { get; set; } = FPosType.NONE;
        //级联的Hole_data
        public List<HoleData> HoleDataList { get; set; } = new List<HoleData>();

    }

    //Hole_data 数据库落数 记录孔数据
    public class HoleData
    {
        public string Hole_Name { get; set; }
        //零件行号
        public int LineNo { get; set; } = -1;
        // 直径
        public decimal D{ get; set; }
        //倒角--默认1
        public decimal D_J { get; set; } = 1; 
        public int M_Type{ get; set; }
        //默认
        public int Rc_YesNo { get; set; } = 0;
        //托位深度，无填0
        public decimal TH { get; set; } = 0; 
        public decimal TD { get; set; } = 0; //托位直径，无填0
        public decimal L { get; set; } = 0; //孔之间的长，无填0
        public decimal W { get; set; } = 0; //孔之间的宽，无填0，四孔可填
        public int Quantity{ get; set; } // 数量
        /*   public int plate_LineNo { get; set; }*/
        /*public string  Create_By { get; set; }
        public DateTime Create_Time{ get; set; }*/
        public int process_Type{ get; set; }
        //冗余 不落库
        //关联的孔 2D坐标
        public List<HPoint2D> HPointList { get; set; } = new List<HPoint2D>();

    }

    //孔2D坐标 数据库落数 记录孔数据
    public class HPoint2D
    {
        /*//孔在哪块板上面
        public string BoardCode { get; set; }
        //孔类型
        public string HoleType { get; set; }*/
        //孔名
        public string HoleName { get; set; }

        //从这里开始 需要落数
        //统一由上往下看，以板件中心为0，右为正
        public decimal X { get; set; }
        //统一由上往下看，以板件中心为0，前为正
        public decimal Y { get; set; }
        //板的起点为0
        public decimal Z0 { get; set; } = 0;
        //终点深度，正数
        public decimal Z1 { get; set; }
       /* public string Create_By { get; set; }
        public DateTime Create_Time { get; set; }
        //hole_data的id
        public int Point_id { get; set; }*/
    }

    //传递给ERP的单精框数据
    [Serializable]
    public class FrameItem
    {
        //板名
        public string BoardName { get; set; }
        //框名
        public string FrameName {get; set; }
        //板UID
        public string BoardUID { get; set; } = null;
        //框深
        public double FrameDepth{ get; set; }
        //框宽
        public double FrameWidth { get; set; }
        //框类型 C粗 J精
        public string FrameType { get; set; } = " ";
        //框长
        public double FrameLength { get; set; }
        //数量
        public int Num { get; set; } = 1;
        //左上角类型
        public AngleType TL_Type { get; set; } = AngleType.NONE;
        //左上半径
        public double TL_Radius { get; set; }
        //左下角类型
        public AngleType BL_Type { get; set; } = AngleType.NONE;
        //左下半径
        public double BL_Radius { get; set; }
        //右下角类型
        public AngleType BR_Type { get; set; } = AngleType.NONE;
        //右下半径
        public double BR_Radius { get; set; }
        //右上角类型
        public AngleType TR_Type { get; set; } = AngleType.NONE;
        //右上半径
        public double TR_Radius { get; set; }
        //分中情况
        public FrameSplitType FSType { get; set; } = FrameSplitType.NONE;
        //显示在界面上的数据
        public string Tig { get; set; }
        //分中相对坐标
        public CAD_Point CSPoint { get; set; } = new CAD_Point();
    }
    public enum FrameSplitType
    {
        NONE,//未判定
        S,//是
        N//否
    }

    //ERP视图客户
      public class VCustomer
    {
        //显示内容
        public string showContent { get; set; }
        //客户编号
        public string customerNumber { get; set; }
        //客户名称
        public string customerAliasName { get; set; }
        //销售员
        public string salesPerson { get; set; }
        //厂区(1厂/2厂)
        public int OrgId { get; set; }
        //本地||外地
        public string local { get; set; }
    }

    public class QuoUser
    {
        public string name { get; set; }
        public string code { get; set; }
    }

    public class StandardBoardItemNormSub
    {
        public string category { get; set; }
        public string partCode { get; set; }
        public string partName { get; set; }
        public string aboutBoard { get; set; }
    }


}
